yjx.controller('SwipeController', ['$scope', function SwipeController($scope) {
    $scope.swipe = function ($event) {
        //console.log($event);
    };
}]).controller('TouchController', ['$scope', function SwipeController($scope) {
    $scope.title = '';
}]).controller('TestController', ['$scope', '$location', '$init', 'detailService', function TestController($scope, $location, $init, detailService) {

    $scope.mockObj = [
        {title: 'test1', content: 'go go go', counts: 11},
        {title: '测试', content: 'yes', counts: 20}
    ];

    //*************1.利用服务 打开详情页
    //detailService.openDetaile('components/user/login/login.html');

    //*************2-1.利用路由 直接打开详情页[新增详情页需在 detailService.openDetaile中声明]
    //$location.path($location.path()).search({dts:'login'});

    //*************2-2.构造方法 打开详情页（不重新加载页面）
    $scope.urlOpen = function () {
        $location.path($location.path()).search({dts: 'bindPhone'});
        /*URL解码测试*/
        //var decode = decodeURIComponent("http%3a%2f%2fwww.aiekt.com%2f%3fdts%3dlogin")
        //self.location.href=decode;
        //self.location.href="http://www.aiekt.com";
    }

    $scope.clearCookie = function () {
        //$init.cleanCookies();
        //alert("清除成功")
    };


    function onBridgeReady() {
        WeixinJSBridge.invoke(
            'getBrandWCPayRequest', {
                "appId": "wx92cacf3ff5bc8f7b",     //公众号名称，由商户传入
                "timeStamp": " 1395712654",         //时间戳，自1970年以来的秒数
                "nonceStr": "e61463f8efa94090b1f366cccfbbb444", //随机串
                "package": "prepay_id=u802345jgfjsdfgsdg888",
                "signType": "MD5",         //微信签名方式：
                "paySign": "70EA570631E4BB79628FBCA90534C63FF7FADD89" //微信签名
            },
            function (res) {
                if (res.err_msg == "get_brand_wcpay_request：ok") {
                }     // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。
            }
        );
    }

    $scope.clickPay =function(){
        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
                document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
            }
        } else {
            onBridgeReady();
        }
    }

}])